define(function(require, exports){
	var $ = require("jquery");
	var pubjs = require('pubjs');
	var view = require('@base/view');
	var util = require('util');
	var Edit = require('@mod/fieldEdit').base;
	var dspUtil = require('dspUtil');

	exports.base = Edit.extend({
		init:function(config){
			config = pubjs.conf(config, {
				fields: [
					{text: LANG('数据表'), type: 'input', field: 'type', validate: true}
					,{text: LANG('Id'), tip: LANG('要通知的记录Id'), type: 'input', field: 'id'}
					,{text: LANG(''), type: 'button', field: 'go', config: {
						'value': LANG('确定'),
						'class': 'btn btn-primary'
					}}
				],
				isPop: true,
				urlAdd: 'blackMagic/redis',
				Title: LANG('Redis通知')
			});

			this.$id = null;
			this.Super('init', arguments);
		}
		,dataChange: function(field, v) {
			this.Super('dataChange', arguments);
			if(field === 'go')
			{
				var data = this.getData();
				if(this.validate(data))
				{
					delete data._id;
					delete data.go;
					pubjs.loading.show();
					data.id = data.id.split(',');
					pubjs.mc.send('blackMagic/redis', data, function(err)
					{
						pubjs.loading.hide();
						if(err)
						{
							return pubjs.alert(err.message)
						}

						pubjs.alert(LANG('通知成功'));
					});
				}
			}
		}
	});
});